package com.wushi.lenovo.asia5b.app_ui.other.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mvp.images.WImageLoader;
import com.wushi.lenovo.asia5b.R;
import com.wushi.lenovo.asia5b.app_model.other.CategoryModel;

import java.util.List;

/**
 * Created by zhangyuncai on 2019/2/26.
 */
public class MainMenuAdapter extends BaseQuickAdapter<CategoryModel, BaseViewHolder> {
    public MainMenuAdapter(@Nullable List<CategoryModel> data) {
        super(R.layout.item_mainmenu, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CategoryModel item) {
        if (!TextUtils.isEmpty(item.getIcon())) {
            WImageLoader.displayImage(mContext, item.getIcon(), helper.getView(R.id.iv_menu_icon));
        }
        helper.setText(R.id.tv_menu_title, item.getCat_name());
        helper.setVisible(R.id.iv_menu_icon, item.getSort_order() != -1);
    }
}
